<template>
	<!-- 新增地址 -->
	<div id="newaddress">
		<van-nav-bar
		  title="新增地址"
		  @click-left="onClickLeft"
		  left-arrow
		/>
		<van-address-edit
		  :area-list="areaList"
		  show-set-default
		  show-search-result
		  :search-result="searchResult"
		  :area-columns-placeholder="['请选择', '请选择', '请选择']"
		  @save="onSave"
		  @delete="onDelete"
		  @change-detail="onChangeDetail"
		/>
	</div>
</template>

<script>
	import { areaList } from '@vant/area-data'
	export default {
	  naem: 'newaddress',
	  data() {
	    return {
	      areaList,
	      searchResult: []
	    }
	  },
	  methods: {
	    onSave(i) {
	      this.$router.push({path:'/newaddress'})
	    },
	    onDelete() {
	      Toast('delete');
	    },
		// 修改详细地址时触发
	    onChangeDetail(val) {
	      if (val) {
	        this.searchResult = [
	          {
	            name: '九木集团11栋高亿科技',
	            address: '江西省抚州市临川区高新五路与火炬六路交叉口',
	          },
	        ];
	      } else {
	        this.searchResult = [];
	      }
	    },
		onClickLeft(){
			this.$router.go(-1);
		}
	  },
	  mounted(i) {
	  	// console.log(this.$router.query.list)
	  }
	};
</script>

<style scoped="scoped">
	#newaddress{
		width: 100%;
		height: 100vh;
	}
</style>
